$OpenBSD: patch-src_gpds-xinput-utils_c,v 1.2 2013/04/01 07:27:19 ajacoutot Exp $

https://bugzilla.redhat.com/show_bug.cgi?id=722770
https://bugzilla.gnome.org/show_bug.cgi?id=631068

--- src/gpds-xinput-utils.c.orig	Mon Apr  1 08:52:50 2013
+++ src/gpds-xinput-utils.c	Mon Apr  1 08:52:16 2013
@@ -38,10 +38,13 @@ gpds_xinput_utils_error_quark (void)
 XDeviceInfo *
 gpds_xinput_utils_get_device_info (const gchar *device_name, GError **error)
 {
+    if (!device_name)
+        goto out_gpds_xinput_utils_get_device_info;
     XDeviceInfo *device_infos;
     gint i, n_device_infos;
 
-    device_infos = XListInputDevices(GDK_DISPLAY(), &n_device_infos);
+    device_infos = XListInputDevices(gdk_x11_get_default_xdisplay(),
+                                     &n_device_infos);
 
     for (i = 0; i < n_device_infos; i++) {
         if (device_infos[i].use != IsXExtensionPointer)
@@ -54,6 +57,7 @@ gpds_xinput_utils_get_device_info (const gchar *device
 
     XFreeDeviceList(device_infos);
 
+out_gpds_xinput_utils_get_device_info:
     g_set_error(error,
                 GPDS_XINPUT_UTILS_ERROR,
                 GPDS_XINPUT_UTILS_ERROR_NO_DEVICE,
@@ -98,7 +102,7 @@ gpds_xinput_utils_open_device (const gchar *device_nam
         return NULL;
 
     gdk_error_trap_push();
-    device = XOpenDevice(GDK_DISPLAY(), device_info->id);
+    device = XOpenDevice(gdk_x11_get_default_xdisplay(), device_info->id);
     gdk_error_trap_pop();
     if (!device) {
         g_set_error(error,
